package com.db.stockexchange.common;

/** Represents type of order by price setting */
public enum OrderType {
	MARKET("1"), LIMIT("2");
	
	private String type;
	
	private OrderType(String type) {
		this.type = type;
	}
	public static OrderType fromString(String type) {
		switch (type) {
		case "1": return MARKET;
		case "2": return LIMIT;
		default:
			throw new IllegalArgumentException("Illegal order type");
		}
	}
	
	public String asString() {
		return type;
	}
}
